package lab01;

import java.util.Scanner;

public class Test12 {
    public static void main(String[] args) {
        int a;
        int b;
        int c;
        int d;
        int num=0;

        System.out.println("请输入一个1-9999之间的数");
        Scanner input=new Scanner(System.in);
        num=input.nextInt();

        if (num<=9999&&num>1) {
            a = num / 1000;
            b = (num % 1000) / 100;
            c = (num % 100) / 10;
            d = num % 10;

            if (a != 0) {
                System.out.println(num + "是四位数");
                if (a == d && b == c) {
                    System.out.println(num + "是回文数");
                } else {
                    System.out.println(num + "不是回文数");
                }
            } else if (b != 0) {
                System.out.println(num + "是三位数");
                if (b == d) {
                    System.out.println("是回文数");
                } else {
                    System.out.println(num + "不是回文数");
                }
            } else if (c != 0) {
                System.out.println(num + "是两位数");
                if (c == d) {
                    System.out.println(num + "是回文数");
                } else {
                    System.out.println(num + "不是回文数");
                }
            } else {
                System.out.println(num + "是回文数");
            }
        }
    }
}
